package com.xmmj.baselibrary.utils.viewadapter.edittext

import android.text.TextWatcher
import android.view.View
import android.widget.EditText
import androidx.databinding.BindingAdapter
import com.xmmj.baselibrary.widget.WithIConEditText

@BindingAdapter(value = ["onIconClickListener"], requireAll = false)
fun setOnIconClickListener(
    editText: WithIConEditText,
    onIconClickListener: WithIConEditText.OnIconClickListener
) {
    editText.setOnIconClickListener(onIconClickListener)
}

@BindingAdapter(value = ["textWatcher"], requireAll = false)
fun addTextChangedListener(editText: EditText, textWatcher: TextWatcher) {
    editText.addTextChangedListener(textWatcher)
}

@BindingAdapter(value = ["onFocusChangeListener"], requireAll = false)
fun setOnFocusChangeListener(
    editText: EditText,
    onFocusChangeListener: View.OnFocusChangeListener
) {
    editText.onFocusChangeListener = onFocusChangeListener
}

